#pragma once
// MESSAGE GUIDE_BOARD PACKING

#define MAVLINK_MSG_ID_GUIDE_BOARD 203


typedef struct __mavlink_guide_board_t {
 int32_t target_lat; /*<  target lat.*/
 int32_t target_lon; /*<  target lon.*/
 float target_height; /*<  target height.*/
 int8_t target_type; /*<  target type.*/
} mavlink_guide_board_t;

#define MAVLINK_MSG_ID_GUIDE_BOARD_LEN 13
#define MAVLINK_MSG_ID_GUIDE_BOARD_MIN_LEN 13
#define MAVLINK_MSG_ID_203_LEN 13
#define MAVLINK_MSG_ID_203_MIN_LEN 13

#define MAVLINK_MSG_ID_GUIDE_BOARD_CRC 176
#define MAVLINK_MSG_ID_203_CRC 176



#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_GUIDE_BOARD { \
    203, \
    "GUIDE_BOARD", \
    4, \
    {  { "target_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_guide_board_t, target_lat) }, \
         { "target_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_guide_board_t, target_lon) }, \
         { "target_height", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_guide_board_t, target_height) }, \
         { "target_type", NULL, MAVLINK_TYPE_INT8_T, 0, 12, offsetof(mavlink_guide_board_t, target_type) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_GUIDE_BOARD { \
    "GUIDE_BOARD", \
    4, \
    {  { "target_lat", NULL, MAVLINK_TYPE_INT32_T, 0, 0, offsetof(mavlink_guide_board_t, target_lat) }, \
         { "target_lon", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_guide_board_t, target_lon) }, \
         { "target_height", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_guide_board_t, target_height) }, \
         { "target_type", NULL, MAVLINK_TYPE_INT8_T, 0, 12, offsetof(mavlink_guide_board_t, target_type) }, \
         } \
}
#endif

/**
 * @brief Pack a guide_board message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param target_lat  target lat.
 * @param target_lon  target lon.
 * @param target_height  target height.
 * @param target_type  target type.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_guide_board_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               int32_t target_lat, int32_t target_lon, float target_height, int8_t target_type)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_GUIDE_BOARD_LEN];
    _mav_put_int32_t(buf, 0, target_lat);
    _mav_put_int32_t(buf, 4, target_lon);
    _mav_put_float(buf, 8, target_height);
    _mav_put_int8_t(buf, 12, target_type);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GUIDE_BOARD_LEN);
#else
    mavlink_guide_board_t packet;
    packet.target_lat = target_lat;
    packet.target_lon = target_lon;
    packet.target_height = target_height;
    packet.target_type = target_type;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GUIDE_BOARD_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_GUIDE_BOARD;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_GUIDE_BOARD_MIN_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_CRC);
}

/**
 * @brief Pack a guide_board message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param target_lat  target lat.
 * @param target_lon  target lon.
 * @param target_height  target height.
 * @param target_type  target type.
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_guide_board_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   int32_t target_lat,int32_t target_lon,float target_height,int8_t target_type)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_GUIDE_BOARD_LEN];
    _mav_put_int32_t(buf, 0, target_lat);
    _mav_put_int32_t(buf, 4, target_lon);
    _mav_put_float(buf, 8, target_height);
    _mav_put_int8_t(buf, 12, target_type);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_GUIDE_BOARD_LEN);
#else
    mavlink_guide_board_t packet;
    packet.target_lat = target_lat;
    packet.target_lon = target_lon;
    packet.target_height = target_height;
    packet.target_type = target_type;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_GUIDE_BOARD_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_GUIDE_BOARD;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_GUIDE_BOARD_MIN_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_CRC);
}

/**
 * @brief Encode a guide_board struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param guide_board C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_guide_board_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_guide_board_t* guide_board)
{
    return mavlink_msg_guide_board_pack(system_id, component_id, msg, guide_board->target_lat, guide_board->target_lon, guide_board->target_height, guide_board->target_type);
}

/**
 * @brief Encode a guide_board struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param guide_board C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_guide_board_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_guide_board_t* guide_board)
{
    return mavlink_msg_guide_board_pack_chan(system_id, component_id, chan, msg, guide_board->target_lat, guide_board->target_lon, guide_board->target_height, guide_board->target_type);
}

/**
 * @brief Send a guide_board message
 * @param chan MAVLink channel to send the message
 *
 * @param target_lat  target lat.
 * @param target_lon  target lon.
 * @param target_height  target height.
 * @param target_type  target type.
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_guide_board_send(mavlink_channel_t chan, int32_t target_lat, int32_t target_lon, float target_height, int8_t target_type)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_GUIDE_BOARD_LEN];
    _mav_put_int32_t(buf, 0, target_lat);
    _mav_put_int32_t(buf, 4, target_lon);
    _mav_put_float(buf, 8, target_height);
    _mav_put_int8_t(buf, 12, target_type);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GUIDE_BOARD, buf, MAVLINK_MSG_ID_GUIDE_BOARD_MIN_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_CRC);
#else
    mavlink_guide_board_t packet;
    packet.target_lat = target_lat;
    packet.target_lon = target_lon;
    packet.target_height = target_height;
    packet.target_type = target_type;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GUIDE_BOARD, (const char *)&packet, MAVLINK_MSG_ID_GUIDE_BOARD_MIN_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_CRC);
#endif
}

/**
 * @brief Send a guide_board message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_guide_board_send_struct(mavlink_channel_t chan, const mavlink_guide_board_t* guide_board)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_guide_board_send(chan, guide_board->target_lat, guide_board->target_lon, guide_board->target_height, guide_board->target_type);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GUIDE_BOARD, (const char *)guide_board, MAVLINK_MSG_ID_GUIDE_BOARD_MIN_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_CRC);
#endif
}

#if MAVLINK_MSG_ID_GUIDE_BOARD_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This variant of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_guide_board_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  int32_t target_lat, int32_t target_lon, float target_height, int8_t target_type)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_int32_t(buf, 0, target_lat);
    _mav_put_int32_t(buf, 4, target_lon);
    _mav_put_float(buf, 8, target_height);
    _mav_put_int8_t(buf, 12, target_type);

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GUIDE_BOARD, buf, MAVLINK_MSG_ID_GUIDE_BOARD_MIN_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_CRC);
#else
    mavlink_guide_board_t *packet = (mavlink_guide_board_t *)msgbuf;
    packet->target_lat = target_lat;
    packet->target_lon = target_lon;
    packet->target_height = target_height;
    packet->target_type = target_type;

    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_GUIDE_BOARD, (const char *)packet, MAVLINK_MSG_ID_GUIDE_BOARD_MIN_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_LEN, MAVLINK_MSG_ID_GUIDE_BOARD_CRC);
#endif
}
#endif

#endif

// MESSAGE GUIDE_BOARD UNPACKING


/**
 * @brief Get field target_lat from guide_board message
 *
 * @return  target lat.
 */
static inline int32_t mavlink_msg_guide_board_get_target_lat(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int32_t(msg,  0);
}

/**
 * @brief Get field target_lon from guide_board message
 *
 * @return  target lon.
 */
static inline int32_t mavlink_msg_guide_board_get_target_lon(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int32_t(msg,  4);
}

/**
 * @brief Get field target_height from guide_board message
 *
 * @return  target height.
 */
static inline float mavlink_msg_guide_board_get_target_height(const mavlink_message_t* msg)
{
    return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field target_type from guide_board message
 *
 * @return  target type.
 */
static inline int8_t mavlink_msg_guide_board_get_target_type(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int8_t(msg,  12);
}

/**
 * @brief Decode a guide_board message into a struct
 *
 * @param msg The message to decode
 * @param guide_board C-struct to decode the message contents into
 */
static inline void mavlink_msg_guide_board_decode(const mavlink_message_t* msg, mavlink_guide_board_t* guide_board)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    guide_board->target_lat = mavlink_msg_guide_board_get_target_lat(msg);
    guide_board->target_lon = mavlink_msg_guide_board_get_target_lon(msg);
    guide_board->target_height = mavlink_msg_guide_board_get_target_height(msg);
    guide_board->target_type = mavlink_msg_guide_board_get_target_type(msg);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_GUIDE_BOARD_LEN? msg->len : MAVLINK_MSG_ID_GUIDE_BOARD_LEN;
        memset(guide_board, 0, MAVLINK_MSG_ID_GUIDE_BOARD_LEN);
    memcpy(guide_board, _MAV_PAYLOAD(msg), len);
#endif
}
